package com.im.app.service.impl;

import java.util.Date;
import java.util.List;

import com.im.app.mapper.ServeGroupMapper;
import com.im.app.model.ServeGroup;
import com.im.app.model.User;
import com.im.app.service.IServeGroupService;
import com.im.app.utils.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 客服组Service业务层处理
 *
 * @author ruoyi
 * @date 2023-06-10
 */
@Service
public class ServeGroupServiceImpl implements IServeGroupService
{
    @Resource
    private ServeGroupMapper serveGroupMapper;

    /**
     * 查询客服组
     *
     * @param id 客服组主键
     * @return 客服组
     */
    @Override
    public ServeGroup selectServeGroupById(Integer id)
    {
        return serveGroupMapper.selectServeGroupById(id);
    }

    @Override
    public List<User> selectServeGroupUserById(Integer id){
        return serveGroupMapper.selectServeGroupUserById(id);
    }

    /**
     * 查询客服组列表
     *
     * @param serveGroup 客服组
     * @return 客服组
     */
    @Override
    public List<ServeGroup> selectServeGroupList(ServeGroup serveGroup)
    {
        return serveGroupMapper.selectServeGroupList(serveGroup);
    }

    /**
     * 新增客服组
     *
     * @param serveGroup 客服组
     * @return 结果
     */
    @Override
    public int insertServeGroup(ServeGroup serveGroup) {
        serveGroup.setCreateTime(new Date());
        return serveGroupMapper.insertServeGroup(serveGroup);
    }

    /**
     * 修改客服组
     *
     * @param serveGroup 客服组
     * @return 结果
     */
    @Override
    public int updateServeGroup(ServeGroup serveGroup)
    {
        return serveGroupMapper.updateServeGroup(serveGroup);
    }

    /**
     * 批量删除客服组
     *
     * @param ids 需要删除的客服组主键
     * @return 结果
     */
    @Override
    public int deleteServeGroupByIds(String ids)
    {
        return serveGroupMapper.deleteServeGroupByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除客服组信息
     *
     * @param id 客服组主键
     * @return 结果
     */
    @Override
    public int deleteServeGroupById(Integer id)
    {
        return serveGroupMapper.deleteServeGroupById(id);
    }
}
